package com.pan.utils;

import java.awt.*;

public class RandomFont {
    private static Font get(int size, String fontName){
        int r = (int)Math.random()*3;
        if (Math.random()>0.5){
            size+=r;
        }else {
            size-=r;
        }
        return new Font(fontName,3,size);
    }
    public static Font randomSong(int size){
        return RandomFont.get(size,"宋体");
    }
    public static Font randomTimesNewRoman(int size){
        return RandomFont.get(size,"Times New Roman");
    }

    public static Font randomAnyFont(int size){
        if (Math.random() > 0.5) return randomSong(size);
        return randomTimesNewRoman(size);
    }

}
